package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main3); //
        Log.d("tag1", "onCreate");

        // 通过id查找到组件对象
        TextView textView = findViewById(R.id.tv_name);
        // 读取TextView组件上显示的文本
        String s = textView.getText().toString();

        textView.setText("软件");

        // 通过id查找到组件对象
        ImageView imageView = findViewById(R.id.iv);
        // 设置图片
        imageView.setImageResource(R.drawable.avatar);

        Log.d("tag1", s);

    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d("tag1", "onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.d("tag1", "onResume");
    }
}